The present invention relates generally to the field of computer systems and, more particularly, to systems and methods for compiling source programs, particularly object-oriented ones, into system and application programs.
Before a digital computer may accomplish a desired task, it must receive an appropriate set of instructions. Executed by the computer's microprocessor, these instructions, collectively referred to as a "computer program," direct the operation of the computer. Expectedly, the computer must understand the instructions which it receives before it may undertake the specified activity.
Owing to their digital nature, computers essentially only understand "machine code," i.e., the low-level, minute instructions for performing specific tasks--the sequence of ones and zeros that are interpreted as specific instructions by the computer's microprocessor. Since machine language or machine code is the only language computers actually understand, all other programming languages represent ways of structuring human language so that humans can get computers to perform specific tasks.
While it is possible for humans to compose meaningful programs in machine code, practically all software development today employs one or more of the available programming languages. The most widely used programming languages are the "high-level" languages, such as C or Pascal. These languages allow data structures and algorithms to be expressed in a style of writing which is easily read and understood by fellow programmers.
A program called a "compiler" translates these instructions into the requisite machine language. In the context of this translation, the program which is written in the high-level language is called the "source code" or source program. The low-level or machine language, on the other hand, comprises "object code." Once created, object code (e.g., .obj file) is a separate program in its own right--it includes instructions which may be executed by the target microprocessor. In practice, however, the object code is usually first linked (i.e., combined) with other object code or libraries, which include standard routines.
Compilers are fundamental to modern computing. Translating human-oriented programming languages into computer-oriented machine languages, compilers allow computer programmers to ignore the machine-dependent details of machine language. Instead of focusing on the register set or memory architecture of a particular computer, for instance, one may simply concentrate on solving the problem at hand. Thus, high-level languages are "portable," that is, they afford a level of abstract which permits a single program to be implemented on several different machines, including ones of vastly different architecture.
Of particular interest to the present invention are compiler and development tools designed for graphic user interfaces (GUIs), such as Microsoft.RTM. Windows and Apple.RTM. Macintosh System 7. Employing an intuitive "desktop metaphor", including such familiar objects as file cabinets, folders, and trash cans, these system have largely displaced awkward command-line systems, such as MS-DOS.
While GUIs are easy for the users to use, they are by no means simple to program. Instead, the intuitive user interface belies an extremely complex system, one having hundreds of API (Application Programming Interface) calls. A simple "Hello World" Microsoft Windows program written in C, for example, requires a hundred or so lines of source code. Besides the sheer bulk of the API, however, the programmer faces an even greater challenge--that of understanding the intricacies of a message-driven environment.
At the heart of a GUI such as MS-Windows is a message or event-driven system, one which requires a shift in the way programmers normally think about computer programs. Traditionally, programmers have developed programs consisting of sequential procedures or modes. As such these programs have a well-defined beginning, middle, and end, with little or no flexibility for the user to vary this pre-determined sequence.
A GUI, in contrast, promotes a "modeless" model, that is, one not tied to any particular predefined sequence of modes. To accomplish this, these systems introduce the notion of "events" and "messages." An event is any activity of interest, such as the press of key on a keyboard or movement of a pointing (mouse) device. The system responds to an event by sending a message to the currently executing application(s). In MS-Windows, for instance, when the user clicks a left mouse button, a WM.sub.13 LBUTTONDOWN message is sent. Similarly, pressing a keyboard key causes a WM.sub.13 KEYDOWN message to be sent. If the user selects an item from a menu, a WM.sub.13 COMMAND message is sent. Other messages correspond to manipulating scroll bars (WM.sub.13 HSCROLL, WM.sub. VSCROLL), resizing windows (WM.sub.13 SIZE), redrawing windows (WM.sub.13 PAINT), closing windows (WM.sub.13 CLOSE), and so on.
There are so many messages which may be generated in fact that managing them has become quite a chore in itself. Using C, for example, the programmer writes an event loop that checks to see whether there any messages which must be responded to. In practice, however, this entails writing a gargantuan case statement that dispatches messages to various functions. And in a Windows program of any complexity, this case statement often spans several pages, making development and maintenance of the program an exceedingly difficult task.
While there is much interest in devising tools which reduce or eliminate the complexity of GUI development, efforts to date have been largely unsuccessful. Instead, programmers have had to rely on existing tools and methodology, ones developed for procedurally-driven architectures (e.g., the aforementioned C case statement). Present day tools are, however, largely inadequate for developing application programs for an event-driven architecture. What is needed are methods and systems for simplifying the message processing of an event-driven architecture. Just as high-level languages permit the programmer to focus on the problem at hand and not on the implementation of its solution, systems and methods are needed for relieving the programmer of the burden of message processing. The present invention fulfills this and other needs.